<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>IRremoteESP8266: src/IRtimer.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">IRremoteESP8266
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">IRtimer.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="IRtimer_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">// Copyright 2017 David Conran</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160; </div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor">#ifndef IRTIMER_H_</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#define IRTIMER_H_</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160; </div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#define __STDC_LIMIT_MACROS</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &lt;stdint.h&gt;</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160; </div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment">// Classes</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160; </div>
<div class="line"><a name="l00013"></a><span class="lineno"><a class="line" href="classIRtimer.html">   13</a></span>&#160;<span class="keyword">class </span><a class="code" href="classIRtimer.html">IRtimer</a> {</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;  <a class="code" href="classIRtimer.html#a09d64d689137ef8ca68973bb9e550e76">IRtimer</a>();</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classIRtimer.html#aaaf886de2c9533a8c791242dc575db1a">reset</a>();</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;  uint32_t <a class="code" href="classIRtimer.html#ad655e585f053580d49d8de7d52cd62a1">elapsed</a>();</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#ifdef UNIT_TEST</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;  <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classIRtimer.html#aa8e3ff975ae5468b4727790c828fa032">add</a>(uint32_t usecs);</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="preprocessor">#endif  // UNIT_TEST</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160; </div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l00023"></a><span class="lineno"><a class="line" href="classIRtimer.html#aaa087b8688ff8150e0fc1ec6d5c4a52a">   23</a></span>&#160;  uint32_t <a class="code" href="classIRtimer.html#aaa087b8688ff8150e0fc1ec6d5c4a52a">start</a>;  </div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;};</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160; </div>
<div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="classTimerMs.html">   28</a></span>&#160;<span class="keyword">class </span><a class="code" href="classTimerMs.html">TimerMs</a> {</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;  <a class="code" href="classTimerMs.html#a7bf7f8d2fcf76b27b34ea4705810eef5">TimerMs</a>();</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classTimerMs.html#a25ab025793a4d432e7d4180cbd31157b">reset</a>();</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;  uint32_t <a class="code" href="classTimerMs.html#ad4aa759c58727393f69863b3461dfc09">elapsed</a>();</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="preprocessor">#ifdef UNIT_TEST</span></div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;  <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classTimerMs.html#a77bfc23a029a9172c3dbac03f746b0cb">add</a>(uint32_t msecs);</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="preprocessor">#endif  // UNIT_TEST</span></div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160; </div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="classTimerMs.html#a15ad2e08a5931397391d48f040722f65">   38</a></span>&#160;  uint32_t <a class="code" href="classTimerMs.html#a15ad2e08a5931397391d48f040722f65">start</a>;  </div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;};</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="preprocessor">#endif  // IRTIMER_H_</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aclassTimerMs_html_a15ad2e08a5931397391d48f040722f65"><div class="ttname"><a href="classTimerMs.html#a15ad2e08a5931397391d48f040722f65">TimerMs::start</a></div><div class="ttdeci">uint32_t start</div><div class="ttdoc">Time in mSeconds when the class was instantiated/reset.</div><div class="ttdef"><b>Definition:</b> IRtimer.h:38</div></div>
<div class="ttc" id="aclassIRtimer_html"><div class="ttname"><a href="classIRtimer.html">IRtimer</a></div><div class="ttdoc">This class offers a simple counter in micro-seconds since instantiated.</div><div class="ttdef"><b>Definition:</b> IRtimer.h:13</div></div>
<div class="ttc" id="aclassIRtimer_html_aa8e3ff975ae5468b4727790c828fa032"><div class="ttname"><a href="classIRtimer.html#aa8e3ff975ae5468b4727790c828fa032">IRtimer::add</a></div><div class="ttdeci">static void add(uint32_t usecs)</div><div class="ttdoc">Add time to the timer to simulate elapsed time.</div><div class="ttdef"><b>Definition:</b> IRtimer.cpp:44</div></div>
<div class="ttc" id="aclassIRtimer_html_aaaf886de2c9533a8c791242dc575db1a"><div class="ttname"><a href="classIRtimer.html#aaaf886de2c9533a8c791242dc575db1a">IRtimer::reset</a></div><div class="ttdeci">void reset()</div><div class="ttdoc">Resets the IRtimer object. I.e. The counter starts again from now.</div><div class="ttdef"><b>Definition:</b> IRtimer.cpp:18</div></div>
<div class="ttc" id="aclassIRtimer_html_a09d64d689137ef8ca68973bb9e550e76"><div class="ttname"><a href="classIRtimer.html#a09d64d689137ef8ca68973bb9e550e76">IRtimer::IRtimer</a></div><div class="ttdeci">IRtimer()</div><div class="ttdoc">Class constructor.</div><div class="ttdef"><b>Definition:</b> IRtimer.cpp:15</div></div>
<div class="ttc" id="aclassIRtimer_html_ad655e585f053580d49d8de7d52cd62a1"><div class="ttname"><a href="classIRtimer.html#ad655e585f053580d49d8de7d52cd62a1">IRtimer::elapsed</a></div><div class="ttdeci">uint32_t elapsed()</div><div class="ttdoc">Calculate how many microseconds have elapsed since the timer was started.</div><div class="ttdef"><b>Definition:</b> IRtimer.cpp:28</div></div>
<div class="ttc" id="aclassTimerMs_html_ad4aa759c58727393f69863b3461dfc09"><div class="ttname"><a href="classTimerMs.html#ad4aa759c58727393f69863b3461dfc09">TimerMs::elapsed</a></div><div class="ttdeci">uint32_t elapsed()</div><div class="ttdoc">Calculate how many milliseconds have elapsed since the timer was started.</div><div class="ttdef"><b>Definition:</b> IRtimer.cpp:61</div></div>
<div class="ttc" id="aclassTimerMs_html_a25ab025793a4d432e7d4180cbd31157b"><div class="ttname"><a href="classTimerMs.html#a25ab025793a4d432e7d4180cbd31157b">TimerMs::reset</a></div><div class="ttdeci">void reset()</div><div class="ttdoc">Resets the TimerMs object. I.e. The counter starts again from now.</div><div class="ttdef"><b>Definition:</b> IRtimer.cpp:51</div></div>
<div class="ttc" id="aclassTimerMs_html_a7bf7f8d2fcf76b27b34ea4705810eef5"><div class="ttname"><a href="classTimerMs.html#a7bf7f8d2fcf76b27b34ea4705810eef5">TimerMs::TimerMs</a></div><div class="ttdeci">TimerMs()</div><div class="ttdoc">Class constructor.</div><div class="ttdef"><b>Definition:</b> IRtimer.cpp:48</div></div>
<div class="ttc" id="aclassIRtimer_html_aaa087b8688ff8150e0fc1ec6d5c4a52a"><div class="ttname"><a href="classIRtimer.html#aaa087b8688ff8150e0fc1ec6d5c4a52a">IRtimer::start</a></div><div class="ttdeci">uint32_t start</div><div class="ttdoc">Time in uSeconds when the class was instantiated/reset.</div><div class="ttdef"><b>Definition:</b> IRtimer.h:23</div></div>
<div class="ttc" id="aclassTimerMs_html_a77bfc23a029a9172c3dbac03f746b0cb"><div class="ttname"><a href="classTimerMs.html#a77bfc23a029a9172c3dbac03f746b0cb">TimerMs::add</a></div><div class="ttdeci">static void add(uint32_t msecs)</div><div class="ttdoc">Add time to the timer to simulate elapsed time.</div><div class="ttdef"><b>Definition:</b> IRtimer.cpp:77</div></div>
<div class="ttc" id="aclassTimerMs_html"><div class="ttname"><a href="classTimerMs.html">TimerMs</a></div><div class="ttdoc">This class offers a simple counter in milli-seconds since instantiated.</div><div class="ttdef"><b>Definition:</b> IRtimer.h:28</div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>
